package com.lingdian;

import java.util.ArrayList;
import java.util.Collection;

import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class CustomUserDetailsService implements UserDetailsService{

	@Override
	public UserDetails loadUserByUsername(String userName)
			throws UsernameNotFoundException {
		 Collection<SimpleGrantedAuthority> authorities = new ArrayList<SimpleGrantedAuthority>();
	        authorities.add(new SimpleGrantedAuthority("ROLE_ADMIN"));
		User user = new User("zhangsan","123456",authorities);
		System.out.println("调用CustomUserDetailsService");
		return user;
	}

}
